package com.util;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.util.Properties;

public class DbUtil {
    public static DruidDataSource getDds;
    private static DruidDataSource dds;
    public static DruidDataSource getDds(){
        return dds;
    }
    static {
        try {
            Properties prop = new Properties();
            prop.load(DbUtil.class.getResourceAsStream("/druid.prop"));
            dds = (DruidDataSource) DruidDataSourceFactory.createDataSource(prop);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    private DbUtil() {
    }
}
